package com.example.mykotlinapp

/**
 *
 *
 * @author zhudeshuai
 * @since 2019/7/10
 */

//Elvis运算符
private fun getStrLen(s: String?): Int {
    return s?.length ?: 0
}

//let函数
private fun sendEmailTo(email: String) {
    //...
}

private fun test101() {
    val email: String? = "..."
    if (email != null) {
        sendEmailTo(email)
    }

    //let函数实现
    email?.let {
        sendEmailTo(it)
    }

}

private fun <T> test102(t: T) {
    println(t.toString())
}


private fun main() {
    test102(null)
}